package com.juneyao.log.logcenter.elasticsearch.impl;

import com.juneyao.log.logcenter.elasticsearch.ElasticStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.core.query.IndexQuery;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @author quanbiao
 * @date 2018-07-27
 * es 插入
 */
@Service("elasticStorageService")
public class ElasticStorageServiceImpl implements ElasticStorageService{

    @Autowired
    private ElasticsearchTemplate elasticsearchTemplate;

    /**
     * es storage
     * @param indexQuerys
     */
    @Override
    public void storageIndexSource(List<IndexQuery> indexQuerys) {
        elasticsearchTemplate.bulkIndex(indexQuerys);
    }
}
